﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using MinhTuan;

namespace Products
{
    public class Category
    {
        #region //attribute

            private Int32 _Category_Id;
            private String _Category_Name;
            private String _Category_Title;
            private Int32 _Category_sort;
            private Boolean _IsActive;

        #endregion
        #region //init

                    public Category(
			        Int32 Category_Id,
			        String Category_Name,
			        String Category_Title,
			        Int32 Category_sort,
			        Boolean IsActive
                    )
                {		_Category_Id=Category_Id;
		        _Category_Name=Category_Name;
		        _Category_Title=Category_Title;
		        _Category_sort=Category_sort;
		        _IsActive=IsActive;
                }
               
        	        public Int32 Category_Id
	            {
	              get { return _Category_Id; }
	              set { _Category_Id = value; }
	             }

	        public String Category_Name
	            {
	              get { return _Category_Name; }
	              set { _Category_Name = value; }
	             }

	        public String Category_Title
	            {
	              get { return _Category_Title; }
	              set { _Category_Title = value; }
	             }

	        public Int32 Category_sort
	            {
	              get { return _Category_sort; }
	              set { _Category_sort = value; }
	             }

	        public Boolean IsActive
	            {
	              get { return _IsActive; }
	              set { _IsActive = value; }
	             }
        #endregion
        #region //Method
            public static DataTable GetCategory()
            {
                DataTable tbl = new DataTable();
                try {
                    Access.InitAccess();
                    Access.mySqlCommand.CommandText = "sp_Products_GetCategory";
                    DataSet ds = new DataSet();
                    SqlDataAdapter da = new SqlDataAdapter(Access.mySqlCommand);
                    da.Fill(ds);
                    tbl = ds.Tables[0];
                    Access.ClosedAccess();
                    return tbl;
                    
                }
                catch {
                    Access.ClosedAccess();
                    return tbl;
                }
                
            }
        #endregion
    }
}
